package com.juc.juc_project.controller;

import com.juc.juc_project.threadLocal.RequestHolder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by fangjicai on 2020/3/18.
 */

@RestController
@Slf4j
public class TestController {
    private int count=0;
    @RequestMapping("/test")
    public String test() {
        //加锁 程序由并行编程串行操作  线程封闭
            System.out.println("第" + count + "次测试！");
            count++;
            log.info("controller获取线程ID：" + RequestHolder.getId());
            return "test";
    }
}
